<?php
include "../lib/DAL/DmDanToc.php";

class DanTocBLL{
    function __construct(){
    }
    
    function __destruct(){
    }

    public function SetdantocBLL($row)
    {
        $dantoc= new DmDanToc();
        $dantoc->setdantoc($row['madm_dantoc'],$row['ten_dantoc']);
        return $dantoc;   
    }
    
    public function GetlistDT(){
        $ex=mysql_query("SELECT * FROM dm_dantoc");
        if($ex){
            while($row=mysql_fetch_array($ex)){
                $ds[]=$this->SetdantocBLL($row);
            }
        }
     return $ds;
    }
    
    public function getmadt($ma)
    {
        $ex=mysql_query("SELECT * FROM dm_dantoc WHERE madm_dantoc='$ma'");
        $kq=mysql_fetch_array($ex);
    
        return $kq['ten_dantoc'];
        
    }

    public function Insertdantoc($dt)
    {
        $sql="  INSERT INTO dm_dantoc(madm_dantoc,ten_dantoc) 
                VALUES('".$dt->getmadm_dantoc()."','".$dt->getten_dantoc()."')";
        
        $kq= mysql_query($sql);
        
        return $kq;
    }
}
?>